<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // function foo(){
        //     var str = "hello"
        //     function bar(){
        //         return str
        //     }
        //     return bar
        // }
        // var f = foo()
        // var text = f()
        // console.log(text)
        //防抖，节流

        function inc(){
            var n = 0;
            return function(){
                return n++
            }
        }
        n = inc()
        console.log(n())
        console.log(n())
        console.log(n())
        console.log(n())

        function baz(){
            return 'hello'
        }
        function say(){
            var str = baz() + "你好"
            return str
        }
    </script>
</body>
</html>